package com.gtguigu4.search_sort.exer2;

/**
 * ClassName: LinearSeachTest2
 * Package: com.gtguigu4.search_sort.exer2
 * Description:
 *
 * @Author BuTang
 * @Create 2023/2/24 19:59
 * @Version 1.0
 */
public class LinearSeachTest2 {
    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};

        int target = 5;

        int i = 0;
        for (; i < arr.length; i++) {
            if (i == target) {
                System.out.println("找到了");
            }
        }
        if (i == arr.length) {
            System.out.println("不好意思，没有找到对应的元素");
        }
    }
}
